package com.woniuxy.service.impl;

import com.woniuxy.dao.OrdermanageDetailsDao;
import com.woniuxy.entity.OrdermanageDetails;
import com.woniuxy.service.OrdermanageDetailsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (OrdermanageDetails)表服务实现类
 *
 * @author makejava
 * @since 2021-05-24 11:19:24
 */
@Service("ordermanageDetailsService")
public class OrdermanageDetailsServiceImpl implements OrdermanageDetailsService {
    @Resource
    private OrdermanageDetailsDao ordermanageDetailsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderdtId 主键
     * @return 实例对象
     */
    @Override
    public OrdermanageDetails queryById(Integer orderdtId) {
        return this.ordermanageDetailsDao.queryById(orderdtId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<OrdermanageDetails> queryAllByLimit(int offset, int limit) {
        return this.ordermanageDetailsDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ordermanageDetails 实例对象
     * @return 实例对象
     */
    @Override
    public OrdermanageDetails insert(OrdermanageDetails ordermanageDetails) {
        this.ordermanageDetailsDao.insert(ordermanageDetails);
        return ordermanageDetails;
    }

    /**
     * 修改数据
     *
     * @param ordermanageDetails 实例对象
     * @return 实例对象
     */
    @Override
    public OrdermanageDetails update(OrdermanageDetails ordermanageDetails) {
        this.ordermanageDetailsDao.update(ordermanageDetails);
        return this.queryById(ordermanageDetails.getOrderdtId());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderdtId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer orderdtId) {
        return this.ordermanageDetailsDao.deleteById(orderdtId) > 0;
    }

    /**
     * Auther: Hello Mr. Guo  <br/>
     * Date: 14:09:2021/5/25  <br/>
     * Description:获取所有的子订单数据
     */
    @Override
    public List<OrdermanageDetails> selectOrder() {
        List<OrdermanageDetails> ordermanageDetails = this.ordermanageDetailsDao.selectOrder();
        return ordermanageDetails;
    }

    /**
     * Auther: Hello Mr. Guo  <br/>
     * Date: 12:06:2021/5/28  <br/>
     * Description: 根据父id获取所有子订单对象
     */
    @Override
    public List<OrdermanageDetails> selectByFid(Integer orderdtFid) {
        List<OrdermanageDetails> ordermanageDetails = this.ordermanageDetailsDao.selectByFid(orderdtFid);
        return ordermanageDetails;
    }


}
